class Solution(object):
    def missingElement(self, nums, k):
        """
        :type nums: List[int]
        :type k: int
        :rtype: int
        """
        n = len(nums)
        for i in range(1, n):
            diff = nums[i] - nums[i - 1] - 1
            if diff < k:
                if diff > 0:
                    k -= diff
            else:
                return nums[i - 1] + k
        return nums[-1] + k